<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<HEAD>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="author" content="zhupeng">
	<title>明细</title>
	<script language="javascript" src="../script/common.js" type="text/javascript"></script>
	<script language="javascript" type="text/javascript">
	
		//全局变量
		var org = Common.cOrg();	//当前单位	
		var cro; //申请单对象
		var cardTypeId = getPara("cardType"); //卡片类型
		var cardPackId = getPara("cardPackId")
		var requestCorpId = getPara("destId")
		var cardTypeName = getPara("cardTypeName")
		var qt = {}; //查询数据表格对象
		
		function load(){
			
			setPages(["detail","listview"]);	
			
			Eui.initBeginDateInput("beginDateTd","起始申请日期","searchForm","beginDate","endDate","_pastDate");
			Eui.initEndDateInput("endDateTd","结束申请日期","searchForm","beginDate","endDate","_pastDate");
			searchForm.cardTypeId.value = cardTypeId;
			searchForm.cardTypeName.value = cardTypeName
			searchForm.reqestTo.value = org.id;
			searchForm.cardPackId.value = cardPackId;
			searchForm.status.value = Constants.CARDBILL_STATUS_PASSED ;
			searchForm.requestCorpId.value = requestCorpId ;
			searchForm.requestCorp.value = getPara("destName") ;
			 setTimeout("createTable()",1);
		}
		//生成表格，创建QueryTable对象(查询)
		function createTable(){
			var columns = [];	
			columns[0] = {type:"checkbox"}
			columns[1] = {render:requestIdFunc} 
			qt = new QueryTable("add_request_order","searchForm","datalist",columns);
			qt.showTable();
		}
		//点击申请单号显示申请单明细	
		function requestIdFunc(v,r){
			return "<a href=# onclick=\"showRequestList('"+r[0]+"',"+r[7]+");return false;\">"+v+"</a>";
		}	
		//显示申请单明细页面	 
		function showRequestList(requestId,hasInfo){
			var hight =580;
			var width =700;
			if(!hasInfo){
				hight =240;
				width =600;
			}
			var v = openDialogFrame("/store/request_order_detail.html?id="+requestId,'申请单列表',hight,width);

		}
		//数据保存(增加申请单)
		function onSave(){
			var cardBillId = getPara("cardBillId");
		  	var requestIds = qt.getBoxValue();
		  	if(!requestIds){
		  		showWarning("请选择要增加的申请单"); 
				return;
		  	}
		 	requestIds = requestIds.split(",");  
		 	DWR.call('cardStoreService.addRelatedRequestOrder',cardBillId,requestIds,function(v){
			    dialogBackValue(true)
		 	});
		}
		//较验时间
		function checkDate(){
			if(!checkForm(searchForm))return;
		  	qt.showTable();
		}
	</script>
</HEAD>

<body onload="load()">
	<!--查询静态页面部分-->
	<div id="listview">	
		<!--查询条件form-->
		<div class="searchForm">
			<form id="searchForm" name="searchForm">
			<input type="hidden" id="reqestTo" name="reqestTo">
			<input type="hidden" id="cardTypeId" name="cardTypeId" >
			<input type="hidden" id="cardPackId" name="cardPackId">
			<input type="hidden" id="status" name="status">
			<input type="hidden" id="requestCorpId" name="requestCorpId">
			<table cellSpacing=0 cellPadding=4 width="100%" border=0 >
				<tr>
					<td><label>单据编号&nbsp;&nbsp;&nbsp;&nbsp;</label> <input type="text" name="requestid"  onblur="checkV(this,'number')" maxlength="12" ></td>
					<td><label>申 请 方&nbsp;&nbsp;&nbsp;&nbsp;</label> <input type="text"  name="requestCorp" readonly class="readonly"></td>			
					<td><label>卡片类型</label> <input type="text"  name="cardTypeName" readonly class="readonly"></td>
				</tr>
				<tr>
					<td id="beginDateTd">&nbsp;</td>
					<td id="endDateTd">&nbsp;</td>
					<td><button type="button" onclick="checkDate()">查 询</button></td>
				</tr>
			</table>
			</form>
		</div>
			<!--查询结构列表-->
			<div id=datalist></div>
	</div>
	
		
</body>
</HTML>
